<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/corelib/tools/qpoint.cpp -->
<head>
  <title>Qt 4.3: QPointF Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QPointF Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1>
<p>The QPointF class defines a point in the plane using floating point precision. <a href="#details">More...</a></p>
<pre> #include &lt;QPointF&gt;</pre><ul>
<li><a href="qpointf-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qpointf.html#QPointF">QPointF</a></b> ()</li>
<li><div class="fn"/><b><a href="qpointf.html#QPointF-2">QPointF</a></b> ( const QPoint &amp; <i>point</i> )</li>
<li><div class="fn"/><b><a href="qpointf.html#QPointF-3">QPointF</a></b> ( qreal <i>x</i>, qreal <i>y</i> )</li>
<li><div class="fn"/>bool <b><a href="qpointf.html#isNull">isNull</a></b> () const</li>
<li><div class="fn"/>qreal &amp; <b><a href="qpointf.html#rx">rx</a></b> ()</li>
<li><div class="fn"/>qreal &amp; <b><a href="qpointf.html#ry">ry</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qpointf.html#setX">setX</a></b> ( qreal <i>x</i> )</li>
<li><div class="fn"/>void <b><a href="qpointf.html#setY">setY</a></b> ( qreal <i>y</i> )</li>
<li><div class="fn"/>QPoint <b><a href="qpointf.html#toPoint">toPoint</a></b> () const</li>
<li><div class="fn"/>qreal <b><a href="qpointf.html#x">x</a></b> () const</li>
<li><div class="fn"/>qreal <b><a href="qpointf.html#y">y</a></b> () const</li>
<li><div class="fn"/>QPointF &amp; <b><a href="qpointf.html#operator-2a-eq">operator*=</a></b> ( qreal <i>factor</i> )</li>
<li><div class="fn"/>QPointF &amp; <b><a href="qpointf.html#operator-2b-eq">operator+=</a></b> ( const QPointF &amp; <i>point</i> )</li>
<li><div class="fn"/>QPointF &amp; <b><a href="qpointf.html#operator--eq">operator-=</a></b> ( const QPointF &amp; <i>point</i> )</li>
<li><div class="fn"/>QPointF &amp; <b><a href="qpointf.html#operator-2f-eq">operator/=</a></b> ( qreal <i>divisor</i> )</li>
</ul>
<a name="related-non-members"></a>
<h3>Related Non-Members</h3>
<ul>
<li><div class="fn"/>bool <b><a href="qpointf.html#operator-not-eq-14">operator!=</a></b> ( const QPointF &amp; <i>p1</i>, const QPointF &amp; <i>p2</i> )</li>
<li><div class="fn"/>const QPointF <b><a href="qpointf.html#operator-2a-2">operator*</a></b> ( const QPointF &amp; <i>point</i>, qreal <i>factor</i> )</li>
<li><div class="fn"/>const QPointF <b><a href="qpointf.html#operator-2a-26">operator*</a></b> ( qreal <i>factor</i>, const QPointF &amp; <i>point</i> )</li>
<li><div class="fn"/>const QPointF <b><a href="qpointf.html#operator-2b-5">operator+</a></b> ( const QPointF &amp; <i>p1</i>, const QPointF &amp; <i>p2</i> )</li>
<li><div class="fn"/>const QPointF <b><a href="qpointf.html#operator--3">operator-</a></b> ( const QPointF &amp; <i>p1</i>, const QPointF &amp; <i>p2</i> )</li>
<li><div class="fn"/>const QPointF <b><a href="qpointf.html#operator--12">operator-</a></b> ( const QPointF &amp; <i>point</i> )</li>
<li><div class="fn"/>const QPointF <b><a href="qpointf.html#operator-2f-2">operator/</a></b> ( const QPointF &amp; <i>point</i>, qreal <i>divisor</i> )</li>
<li><div class="fn"/>QDataStream &amp; <b><a href="qpointf.html#operator-lt-lt-45">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>stream</i>, const QPointF &amp; <i>point</i> )</li>
<li><div class="fn"/>bool <b><a href="qpointf.html#operator-eq-eq-23">operator==</a></b> ( const QPointF &amp; <i>p1</i>, const QPointF &amp; <i>p2</i> )</li>
<li><div class="fn"/>QDataStream &amp; <b><a href="qpointf.html#operator-gt-gt-27">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>stream</i>, QPointF &amp; <i>point</i> )</li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QPointF class defines a point in the plane using floating point precision.</p>
<p>A point is specified by a x coordinate and an y coordinate which can be accessed using the <a href="qpointf.html#x">x</a>() and <a href="qpointf.html#y">y</a>() functions. The coordinates of the point are specified using floating point numbers for accuracy. The <a href="qpointf.html#isNull">isNull</a>() function returns true if both x and y are set to 0.0&#x2e; The coordinates can be set (or altered) using the <a href="qpointf.html#setX">setX</a>() and <a href="qpointf.html#setY">setY</a>() functions, or alternatively the <a href="qpointf.html#rx">rx</a>() and <a href="qpointf.html#ry">ry</a>() functions which return references to the coordinates (allowing direct manipulation).</p>
<p>Given a point <i>p</i>, the following statements are all equivalent:</p>
<pre> QPointF p;

 p.setX(p.x() + 1.0);
 p += QPoint(1.0, 0.0);
 p.rx()++;</pre>
<p>A QPointF object can also be used as a vector: Addition and subtraction are defined as for vectors (each component is added separately). A QPointF object can also be divided or multiplied by an <tt>int</tt> or a <tt>qreal</tt>.</p>
<p>In addition, the QPointF class provides a constructor converting a <a href="qpoint.html">QPoint</a> object into a QPointF object, and a corresponding <a href="qpointf.html#toPoint">toPoint</a>() function which returns a <a href="qpoint.html">QPoint</a> copy of <i>this</i> point. Finally, QPointF objects can be streamed as well as compared.</p>
<p>See also <a href="qpoint.html">QPoint</a> and <a href="qpolygonf.html">QPolygonF</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QPointF"></a>QPointF::QPointF ()</h3>
<p>Constructs a null point, i.e&#x2e; with coordinates (0.0, 0.0)</p>
<p>See also <a href="qpointf.html#isNull">isNull</a>().</p>
<h3 class="fn"><a name="QPointF-2"></a>QPointF::QPointF ( const <a href="qpoint.html">QPoint</a> &amp; <i>point</i> )</h3>
<p>Constructs a copy of the given <i>point</i>.</p>
<p>See also <a href="qpointf.html#toPoint">toPoint</a>().</p>
<h3 class="fn"><a name="QPointF-3"></a>QPointF::QPointF ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>x</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>y</i> )</h3>
<p>Constructs a point with the given coordinates (<i>x</i>, <i>y</i>).</p>
<p>See also <a href="qpointf.html#setX">setX</a>() and <a href="qpointf.html#setY">setY</a>().</p>
<h3 class="fn"><a name="isNull"></a>bool QPointF::isNull () const</h3>
<p>Returns true if both the x and y coordinates are set to 0.0, otherwise returns false.</p>
<h3 class="fn"><a name="rx"></a><a href="qtglobal.html#qreal-typedef">qreal</a> &amp; QPointF::rx ()</h3>
<p>Returns a reference to the x coordinate of this point.</p>
<p>Using a reference makes it possible to directly manipulate x. For example:</p>
<pre> QPoint p(1.1, 2.5);
 p.rx()--;   <span class="comment">//</span> p becomes (0.1, 2.5)</pre>
<p>See also <a href="qpointf.html#x">x</a>() and <a href="qpointf.html#setX">setX</a>().</p>
<h3 class="fn"><a name="ry"></a><a href="qtglobal.html#qreal-typedef">qreal</a> &amp; QPointF::ry ()</h3>
<p>Returns a reference to the y coordinate of this point.</p>
<p>Using a reference makes it possible to directly manipulate y. For example:</p>
<pre> QPoint p(1.1, 2.5);
 p.ry()++;   <span class="comment">//</span> p becomes (1.1, 3.5)</pre>
<p>See also <a href="qpointf.html#y">y</a>() and <a href="qpointf.html#setY">setY</a>().</p>
<h3 class="fn"><a name="setX"></a>void QPointF::setX ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>x</i> )</h3>
<p>Sets the x coordinate of this point to the given <i>x</i> coordinate.</p>
<p>See also <a href="qpointf.html#x">x</a>() and <a href="qpointf.html#setY">setY</a>().</p>
<h3 class="fn"><a name="setY"></a>void QPointF::setY ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>y</i> )</h3>
<p>Sets the y coordinate of this point to the given <i>y</i> coordinate.</p>
<p>See also <a href="qpointf.html#y">y</a>() and <a href="qpointf.html#setX">setX</a>().</p>
<h3 class="fn"><a name="toPoint"></a><a href="qpoint.html">QPoint</a> QPointF::toPoint () const</h3>
<p>Rounds the coordinates of this point to the nearest integer, and returns a <a href="qpoint.html">QPoint</a> object with the rounded coordinates.</p>
<p>See also <a href="qpointf.html#QPointF">QPointF</a>().</p>
<h3 class="fn"><a name="x"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QPointF::x () const</h3>
<p>Returns the x-coordinate of this point.</p>
<p>See also <a href="qpointf.html#setX">setX</a>() and <a href="qpointf.html#rx">rx</a>().</p>
<h3 class="fn"><a name="y"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QPointF::y () const</h3>
<p>Returns the y-coordinate of this point.</p>
<p>See also <a href="qpointf.html#setY">setY</a>() and <a href="qpointf.html#ry">ry</a>().</p>
<h3 class="fn"><a name="operator-2a-eq"></a>QPointF &amp; QPointF::operator*= ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>factor</i> )</h3>
<p>Multiplies this point's coordinates by the given <i>factor</i>, and returns a reference to this point. For example:</p>
<pre> QPoint p(-1.1, 4.1);
 p *= 2.5;    <span class="comment">//</span> p becomes (-2.75,10.25)</pre>
<p>See also <a href="qpointf.html#operator-2f-eq">operator/=</a>().</p>
<h3 class="fn"><a name="operator-2b-eq"></a>QPointF &amp; QPointF::operator+= ( const QPointF &amp; <i>point</i> )</h3>
<p>Adds the given <i>point</i> to this point and returns a reference to this point. For example:</p>
<pre> QPoint p( 3.1, 7.1);
 QPoint q(-1.0, 4.1);
 p += q;    <span class="comment">//</span> p becomes (2.1, 11.2)</pre>
<p>See also <a href="qpointf.html#operator--eq">operator-=</a>().</p>
<h3 class="fn"><a name="operator--eq"></a>QPointF &amp; QPointF::operator-= ( const QPointF &amp; <i>point</i> )</h3>
<p>Subtracts the given <i>point</i> from this point and returns a reference to this point. For example:</p>
<pre> QPoint p( 3.1, 7.1);
 QPoint q(-1.0, 4.1);
 p -= q;    <span class="comment">//</span> p becomes (4.1, 3.0)</pre>
<p>See also <a href="qpointf.html#operator-2b-eq">operator+=</a>().</p>
<h3 class="fn"><a name="operator-2f-eq"></a>QPointF &amp; QPointF::operator/= ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>divisor</i> )</h3>
<p>Divides both x and y by the given <i>divisor</i>, and returns a reference to this point. For example:</p>
<pre> QPoint p(-2.75, 10.25);
 p /= 2.5;           <span class="comment">//</span> p becomes (-1.1,4.1)</pre>
<p>See also <a href="qpointf.html#operator-2a-eq">operator*=</a>().</p>
<hr />
<h2>Related Non-Members</h2>
<h3 class="fn"><a name="operator-not-eq-14"></a>bool operator!= ( const QPointF &amp; <i>p1</i>, const QPointF &amp; <i>p2</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns true if <i>p1</i> is not equal to <i>p2</i>; otherwise returns false.</p>
<h3 class="fn"><a name="operator-2a-2"></a>const QPointF operator* ( const QPointF &amp; <i>point</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>factor</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns a copy of the given <i>point</i>, multiplied by the given <i>factor</i>.</p>
<p>See also <a href="qpointf.html#operator-2a-eq">QPointF::operator*=</a>().</p>
<h3 class="fn"><a name="operator-2a-26"></a>const QPointF operator* ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>factor</i>, const QPointF &amp; <i>point</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns a copy of the given <i>point</i>, multiplied by the given <i>factor</i>.</p>
<h3 class="fn"><a name="operator-2b-5"></a>const QPointF operator+ ( const QPointF &amp; <i>p1</i>, const QPointF &amp; <i>p2</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns a <a href="qpointf.html">QPointF</a> object that is the sum of the given points, <i>p1</i> and <i>p2</i>; each component is added separately.</p>
<p>See also <a href="qpointf.html#operator-2b-eq">QPointF::operator+=</a>().</p>
<h3 class="fn"><a name="operator--3"></a>const QPointF operator- ( const QPointF &amp; <i>p1</i>, const QPointF &amp; <i>p2</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns a <a href="qpointf.html">QPointF</a> object that is formed by subtracting <i>p2</i> from <i>p1</i>; each component is subtracted separately.</p>
<p>See also <a href="qpointf.html#operator--eq">QPointF::operator-=</a>().</p>
<h3 class="fn"><a name="operator--12"></a>const QPointF operator- ( const QPointF &amp; <i>point</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns a <a href="qpointf.html">QPointF</a> object that is formed by changing the sign of both components of the given <i>point</i>.</p>
<p>Equivalent to <tt>QPointF(0,0) - point</tt>.</p>
<h3 class="fn"><a name="operator-2f-2"></a>const QPointF operator/ ( const QPointF &amp; <i>point</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>divisor</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns the <a href="qpointf.html">QPointF</a> object formed by dividing both components of the given <i>point</i> by the given <i>divisor</i>.</p>
<p>See also <a href="qpointf.html#operator-2f-eq">QPointF::operator/=</a>().</p>
<h3 class="fn"><a name="operator-lt-lt-45"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>stream</i>, const QPointF &amp; <i>point</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Writes the given <i>point</i> to the given <i>stream</i> and returns a reference to the stream.</p>
<p>See also <a href="datastreamformat.html">Format of the QDataStream Operators</a>.</p>
<h3 class="fn"><a name="operator-eq-eq-23"></a>bool operator== ( const QPointF &amp; <i>p1</i>, const QPointF &amp; <i>p2</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns true if <i>p1</i> is equal to <i>p2</i>; otherwise returns false.</p>
<h3 class="fn"><a name="operator-gt-gt-27"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>stream</i>, QPointF &amp; <i>point</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Reads a point from the given <i>stream</i> into the given <i>point</i> and returns a reference to the stream.</p>
<p>See also <a href="datastreamformat.html">Format of the QDataStream Operators</a>.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
